#!/bin/bash
echo "<html><head>"
echo "<title>HTML ShellScript Generated</title>"
[ "$p_window" == "maximized" ] && echo "<scripttool window=maximized>"
[ "$p_window" == "fullscreen" ] && echo "<scripttool window=fullscreen>"
[ "$p_window" == "normal" ] && echo "<scripttool window=normal>"
[ "$p_setsize" == "change" ] && echo "<scripttool size=800x600>"
echo "<LINK REL=\"SHORTCUT ICON\" HREF=\"icone.png\">"
echo "</head>"
echo "<body>"
echo "<h1>Hello  `whoami`!</h1>"
echo "<i>Today is `date`</i><br/><br/>"

if (( $# >= 1 ))
then
    echo "The command line arguments was: <font color=red>$*</font><br/>"
    echo "In \"\$plist\" has: <font color=red>$plist</font><br/>"
    plist=`echo "$plist" | tr -d " " | tr -d "\""`
    O_IFS="$IFS"
    IFS=","
    for x in $plist
    do
    echo $x
	content=$(eval echo $`echo $x`)
	echo "In \"\$$x\" has: <font color=red>$content</font><br/>"
    done
    IFS="$O_IFS"
    
else
    echo "There were no arguments<br/>"
fi
echo "<br/>"
echo "<b>Window width: </b> $WINDOW_WIDTH <br/>"
echo "<b>Window height: </b> $WINDOW_HEIGHT <br/>"
echo "<b>Screen width: </b> $SCREEN_WIDTH <br/>"
echo "<b>Scren height: </b> $SCREEN_HEIGHT <br/>"

echo "<br/>"
echo "<a href=javascript:window.resizeTo(320,240); >Click here to change window size using javascript</a><br />"
echo "<a href=file://$0?setsize=change >Click here to change window size using scripttool</a><br />"
echo '<a href=file://exemplo.sh?argument1=content1&argument2=content2&argument3=content3>Call this scripts with arguments<br/>'
echo '<a href=file://exemplo2.sh>Call another script<br/>'
echo '<a href=file://exemplo.sh?window=fullscreen>Set window fullscreen<br/>'
echo '<a href=file://exemplo.sh?window=maximized>Set window maximized<br/>'
echo '<a href=file://exemplo.sh?window=normal>Set window normal<br/>'
echo '<a href=http://www.google.com.br/>Open Google<br/>'
echo "<a href=javascript:close('window'); >Click here to close using javascript</a><br/>"
echo "<a href=exemplo2.sh?close=True>Click here to close using scripttool</a>"

echo "</body></html>"

